package org.shay.springcloud.service.system.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author shay
 * @date 2020/5/9
 */
@RefreshScope
@RestController
@RequestMapping("nacos")
@Api(value = "Nacos", tags = "Nacos接口")
public class NacosController {

	@Resource
	private ConfigurableApplicationContext applicationContext;

	@GetMapping("test")
	@ApiOperation(value = "Nacos 配置读取")
	public String test(String key) {
		return applicationContext.getEnvironment().getProperty(key);
	}
}
